package com.haima.sage.bigdata.api.entity.auditlog;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class OperateTypeConvert implements AttributeConverter<OperateType, String> {
    @Override
    public String convertToDatabaseColumn(OperateType attribute) {
        return attribute.toString();
    }

    @Override
    public OperateType convertToEntityAttribute(String dbData) {
        if (dbData == null) {
            return null;
        }
        return OperateType.getInstance(dbData);
    }
}